package com.ciwong.epaper.modules.me.ui;

import com.google.gson.Gson;

/**
 * Created by keepon on 2018/5/31.
 */
public class JsonParserUtil {
	public static  String toJson(Object object){
		try {
			Gson gson = new Gson();
			String s = gson.toJson(object);
			return  s;
		}catch (Exception e){
			return "";
		}
	}
	public static <T> T  fromJson(String json, Class<T> classOfT){
		try {
			Gson gson = new Gson();
			T t = gson.fromJson(json, classOfT);
			return  t;
		}catch (Exception e){
			return null;
		}
	}
}
